package it.globalgamejam.dsm.menu 
{
	import net.flashpunk.Entity;
	import it.globalgamejam.dsm.Assets;
	import net.flashpunk.FP;
	import net.flashpunk.graphics.Image;
	import net.flashpunk.tweens.misc.VarTween;
	import net.flashpunk.World;
	/**
	 * ...
	 * @author self
	 */
	public class cards extends Entity
	{
		var worlda:World;	
		
		public function cards(x: Number, y:Number, card:Number, word:World) 
		{
			this.worlda = word;
			super(x, y);
			switch (card) 
			{
				case 1:
			graphic = new Image(Assets.card1);
			break;
				case 2:
			graphic = new Image(Assets.card2);
			break;
				case 3:
			graphic = new Image(Assets.card3);
			break;
				case 4:
			graphic = new Image(Assets.card4);
			break;
				case 5:
			graphic = new Image(Assets.card5);
			break;
				case 6:
			graphic = new Image(Assets.card6);
			break;
				case 7:
			graphic = new Image(Assets.card7);
			break;
				case 8:
			graphic = new Image(Assets.card8);
			break;
				case 9:
			graphic = new Image(Assets.card9);
			break;
				case 10:
			graphic = new Image(Assets.card10);
			break;
				case 11:
			graphic = new Image(Assets.card11);
			break;
				case 12:
			graphic = new Image(Assets.card12);
			break;
				case 13:
			graphic = new Image(Assets.card13);
			break;
			}		
			
			if (card == 13)
			{
			Image(graphic).scaledHeight = 150;
			Image(graphic).scaledWidth = 150;
			Image(graphic).originX = Image(graphic).width / 2 + Image(graphic).width / 4;
			Image(graphic).originY = Image(graphic).height / 2 + Image(graphic).height / 4;
			Image(graphic).x = Image(graphic).scaledWidth / 2;
			Image(graphic).y = Image(graphic).scaledHeight / 2;
			}
			else
			{
			Image(graphic).scaledHeight = Image(graphic).height / 2 + 160;
			Image(graphic).scaledWidth = Image(graphic).width / 2 + 160;
			Image(graphic).originX = Image(graphic).width / 2 + Image(graphic).width / 4;
			Image(graphic).originY = Image(graphic).height / 2 + Image(graphic).height / 4;
			Image(graphic).x = Image(graphic).scaledWidth / 2;
			Image(graphic).y = Image(graphic).scaledHeight / 2;
			}
		}
		
		public function moveTween(new_x:Number, new_y:Number, new_angle:Number, type:Number):void
		{
		//	if (type == 1 )
		//	{
		//		var tween:VarTween = new VarTween();
		//		tween.tween(Image(this.graphic), "scale", new_x, 3 );
		//	}
		//	else
			{
			
			var tween:VarTween = new VarTween();
			tween.tween(this, "x", new_x, 0.5 );
			this.worlda.addTween(tween);
			var tween2:VarTween = new VarTween();
			tween2.tween(this, "y", new_y, 0.5 );
			this.worlda.addTween(tween2);
			var tween3:VarTween = new VarTween();
						
			tween3.tween(Image(this.graphic), "angle", new_angle, 0.5 );
			this.worlda.addTween(tween3);
			}

		}
	}

}